package demo8;

public class Recursive_Multiply {
    /**
     * use + - >> <<
     * 10 * 20 =200
     * 20 + 20 +..+20 (times=10)
     *
     */
    public void multiplyWithRecursionInitAndStart(int x,int y){
        int num = x>y?x:y;
        int times=x>y?y:x;
        int i = multiplyWithRecursion(num, num, times);
        System.out.println(x+"*"+y+"="+i);
    }
    public int multiplyWithRecursion(int x,int size,int times){
        if(times==1){
            return x;
        }
        return multiplyWithRecursion(x+size,size,times-1);
    }

}
